<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>画个圆</title>
    <style type="text/css">
        .wrapper{
            width: 100px;
            height: 100px;
        }
        .circle {
            position: relative;
            width: 100px;
            height: 100px;
            display: -webkit-box;
            -webkit-box-pack: center;
            -webkit-box-align: center;
            background: #fff;
            border-radius: 50%;
            box-shadow: 0 0 0 10px red inset;
        }
        .shade {
            width: 50%;
            height: 100%;
            overflow: hidden;
        }
        .shade-left, .shade-right {
            position: relative;
            margin: 0;
            padding: 0;
            -webkit-box-flex: 1;
            height: 80px;
            background: #fff;
            border: 10px solid grey;
            overflow: hidden;
        }
        .shade-left {
            border-radius: 50px 0 0 50px;
            border-color: grey transparent grey grey;
            transform-origin: 100% 50%;
            z-index: 1;
            transform:rotate(0deg);
            -ms-transform:rotate(0deg); 	/* IE 9 */
            -moz-transform:rotate(0deg); 	/* Firefox */
            -webkit-transform:rotate(0deg); /* Safari 和 Chrome */
            -o-transform:rotate(0deg); 	/* Opera */
        }
        .shade-right {
            border-radius: 0 50px 50px 0;
            border-color: grey grey grey transparent;
            transform-origin: 0 50%;
            z-index: 2;
            transform:rotate(0deg);
            -ms-transform:rotate(0deg); 	/* IE 9 */
            -moz-transform:rotate(0deg); 	/* Firefox */
            -webkit-transform:rotate(0deg); /* Safari 和 Chrome */
            -o-transform:rotate(0deg); 	/* Opera */
        }
        .content {
            position: absolute;
            width: 80px;
            height: 80px;
            left: 50%;
            margin-left: -40px;
            top: 50%;
            margin-top: -40px;
            z-index: 3;
            border-radius: 50%;
            overflow: hidden;
            word-wrap: break-word;
            background-color: darkgray;
        }
    </style>
</head>
<body>
<div class="wrapper">
    <div class="circle">
        <div class="shade">
            <div id="shade-left" class="shade-left"></div>
        </div>
        <div class="shade">
            <div id="shade-right" class="shade-right"></div>
        </div>
        <div class="content">
            12345678910111213141516171819
        </div>
    </div>
</div>
<script type="text/javascript">
    var totalTime = 60;
    var startTime = 0;
    var pass = startTime;
    function draw(pass, total) {
      var div_right = document.getElementById('shade-right');
      var div_left = document.getElementById('shade-left');
      var percent = pass/total;
      if (pass * 2 <= total) {  // 未过一半
        var jiaodu = percent * 360;
        div_right.style.webkitTransform = 'rotate('+jiaodu+'deg)';
        div_right.style.mozTransform = 'rotate('+jiaodu+'deg)';
        div_right.style.msTransform = 'rotate('+jiaodu+'deg)';
        div_right.style.oTransform = 'rotate('+jiaodu+'deg)';
        div_right.style.transform = 'rotate('+jiaodu+'deg)';
      } else if (pass * 2 > total && pass < total) {    // 已过一半
        var jiaodu = (percent - 0.5) * 360;
        div_right.style.webkitTransform = 'rotate(180deg)';
        div_right.style.mozTransform = 'rotate(180deg)';
        div_right.style.msTransform = 'rotate(180deg)';
        div_right.style.oTransform = 'rotate(180deg)';
        div_right.style.transform = 'rotate(180deg)';
        div_left.style.webkitTransform = 'rotate('+jiaodu+'deg)';
        div_left.style.mozTransform = 'rotate('+jiaodu+'deg)';
        div_left.style.msTransform = 'rotate('+jiaodu+'deg)';
        div_left.style.oTransform = 'rotate('+jiaodu+'deg)';
        div_left.style.transform = 'rotate('+jiaodu+'deg)';
      } else if (pass >= total) {
        div_right.style.webkitTransform = 'rotate(180deg)';
        div_right.style.mozTransform = 'rotate(180deg)';
        div_right.style.msTransform = 'rotate(180deg)';
        div_right.style.oTransform = 'rotate(180deg)';
        div_right.style.transform = 'rotate(180deg)';
        div_left.style.webkitTransform = 'rotate(180deg)';
        div_left.style.mozTransform = 'rotate(180deg)';
        div_left.style.msTransform = 'rotate(180deg)';
        div_left.style.oTransform = 'rotate(180deg)';
        div_left.style.transform = 'rotate(180deg)';
      }
    }

    draw(startTime, totalTime);
    var interval = setInterval(function () {
      pass+=0.1;
      if (pass <= totalTime) {
        draw(pass, totalTime);
      } else {
        clearInterval(interval);
      }
    }, 100);
</script>
</body>
</html>